<template>
  <div>homechild....</div>
  <hr />
  <h1>{{ num.count }}--sun{{ sun }}-----{{ numCount }}</h1>
  <button @click="change">点击相加</button>
  <hr />
  <Child :msg="sun"></Child>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, watchEffect } from 'vue'
import Child from '@/components/ChildCom.vue'
// const count = ref(26)
// const change = function () {
//   count.value++
// }
// const numCount = computed(() => count.value * 2)
const sun = ref(1)
const num = reactive({
  count: 10
})
const change = function () {
  num.count++, sun.value++
}
const numCount = computed(() => num.count * 2)
// watch(
//   sun,
//   (num, old) => {
//     console.log('sun', num, old)
//   },
//   { immediate: true }
// )
//数据监听
watchEffect(() => {
  const x = num.count
  console.log('12344', x)
})
</script>
